#!/usr/bin/env bash

# 作者: Andy <admin_at_simplemail.cn>

#---------------------------------------------------------------------
# 本文件是 SimpleMail 的一部分，它是一个针对 Red Hat(R) Enterprise Linux、CentOS、Debian 和 Ubuntu 的开源邮件服务器解决方案。
#
# SimpleMail 是自由软件：您可以根据自由软件基金会发布的 GNU 通用公共许可证的条款，重新分发和/或修改它。
# 许可证的版本可以是第 3 版，或者（根据您的选择）任何更高版本。
#
# 分发 SimpleMail 是希望它能有用，但没有任何保证；甚至没有适销性或特定用途适用性的暗示保证。
# 有关更多详细信息，请参阅 GNU 通用公共许可证。
#
# You should have received a copy of the GNU General Public License
# along with iRedMail.  If not, see <http://www.gnu.org/licenses/>.
#---------------------------------------------------------------------

export SIMPLEAPD_VERSION='5.8.1'
export SYS_USER_SIMPLEAPD='simpleapd'
export SYS_GROUP_SIMPLEAPD='simpleapd'

export SIMPLEAPD_TARBALL="SimpleAPD-${SIMPLEAPD_VERSION}.tar.gz"
export SIMPLEAPD_PARENT_DIR='/opt'
export SIMPLEAPD_ROOT_DIR="${SIMPLEAPD_PARENT_DIR}/SimpleAPD-${SIMPLEAPD_VERSION}"
export IREDAPD_ROOT_DIR_SYMBOL_LINK="${IREDAPD_PARENT_DIR}/iredapd"
export IREDAPD_CONF="${IREDAPD_ROOT_DIR_SYMBOL_LINK}/settings.py"

# IREDAPD_BIND_HOST is configured in conf/global
export IREDAPD_LISTEN_PORT='7777'
export IREDAPD_SRS_FORWARD_PORT='7778'
export IREDAPD_SRS_REVERSE_PORT='7779'
export IREDAPD_SRS_SECRET="$(${RANDOM_STRING})"

export IREDAPD_PID_FILE='/var/run/iredapd.pid'
export IREDAPD_LOG_DIR='/var/log/iredapd'
export SIMPLEAPD_LOG_FILE="${SIMPLEAPD_LOG_DIR}/simpleapd.log"
export SIMPLEAPD_LOGROTATE_FILE="${LOGROTATE_DIR}/simpleapd"

# Database
# IREDAPD_DB_PASSWD is generated in dialog/optional_components.sh.
export SIMPLEAPD_DB_NAME='simpleapd'
export SIMPLEAPD_DB_USER='simpleapd'


if [ X"${DISTRO}" == X'FREEBSD' ]; then
    export IREDAPD_LOGROTATE_FILE="${LOGROTATE_DIR}/iredapd.conf"
fi
